package com.four.controller;

import com.four.entity.Dept;
import com.four.service.DeptService;
import com.four.vo.Result;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年10月13日16:04
 */
@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @GetMapping("/checkDept")
    public Result checkDept(){
        return deptService.selectAll();
    }

    @PostMapping ("/add")
    public Result add(@RequestBody Dept record){
        System.out.println("record = " + record);
        return deptService.add(record);
    }

    @GetMapping("/delete")
    public Result delete(int id){
        return deptService.delete(id);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Dept record){
        return deptService.update(record);
    }

    @PostMapping("/updateStatus")
    public Result updateStatus( @RequestBody Dept deptId) {

        return this.deptService.updateStatus(deptId);
    }




}
